#!/bin/bash
file=~/klipper/klippy/extras/virtual_sdcard.py

is_reloaded=`cat "${file}" | grep "sys.setdefaultencoding('utf8')"`
if [ "${is_reloaded}" == "" ];then
	cp "${file}" "${file}.bak"
	sed -i "s/import[ ]*os,[ ]*logging/import os, logging\nimport sys\nreload(sys)\nsys.setdefaultencoding('utf8')/g" "${file}"
fi
echo "Enable Chinese file name"
